//
//  main.m
//  oc_13
//
//  Created by 楼楚 on 15/9/14.
//  Copyright (c) 2015年 Chu Lou. All rights reserved.
//

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        
        NSDictionary *dic = [[NSDictionary alloc]initWithObjectsAndKeys:@"one",@"1",@"two",@"2",@"three",@"3",@"one",@"4",nil];
//        vale@"one" @"two" @"three";
//        key @"1" @"2" @"3"
//         字典中所有的key－value都是无序的
        NSString *key = @"1";
        NSString *value = [dic objectForKey:key];
        NSLog(@"%@",value);
        NSDictionary *dic1 = @{@"1":@"one",@"2":@"two"};
        NSLog(@"%@",dic1);
        NSLog(@"%@",[dic1 valueForKey:@"2"]);
        
//        NSEnumerator *enm = [dic keyEnumerator];
//        id obj;
//        while (obj = [enm nextObject]) {
//            NSLog(@"%@",obj);
//        }
        
        NSEnumerator *enm = [dic objectEnumerator];
        id obj;
        while (obj = [enm nextObject]) {
            NSLog(@"%@",obj);
        }
        
        for (obj in dic1) {
            NSLog(@"%@",obj);
            NSLog(@"%@",[dic1 objectForKey:obj]);
        }
        
        
        NSMutableDictionary *mDic = [[NSMutableDictionary alloc]initWithObjectsAndKeys:@"", @"",nil];
        
        NSMutableDictionary *mDic1 = [[NSMutableDictionary alloc]init];
        
        [mDic1 setObject:@"one" forKey:@"1"];
        [mDic1 setObject:@"two" forKey:@"2"];
        [mDic1 setObject:@"three" forKey:@"3"];
        
        [mDic1 removeObjectForKey:@"1"];
        
        NSEnumerator *keys = [dic keyEnumerator];
        NSMutableString *temStr = [[NSMutableString alloc]init];
        while (obj = [keys nextObject]) {
            [temStr appendString:obj];
        }
        NSLog(@"%@",temStr);

        
  
//        NSLog(@"%@",mDic1);
    }
    return 0;
}
